

cc.Class({
    extends: cc.Component,

    properties: {
        shareText : ""
    },

    // LIFE-CYCLE CALLBACKS:

    onLoad () {
        if(!Global.debug){
            //开启微信的转发.
            wx.showShareMenu();
            //监听右上角的分享调用 
            wx.onShareAppMessage(function(res){
                return {
                    title: this.shareText,
                    imageUrl: cc.url.raw("resources/image/share.png"),
                    success(res){
                        console.log("转发成功!!!");
                    },
                    fail(res){
                        console.log("转发失败!!!");
                    } 
                }
            });
        }
    },

    start () {
        
    },

    // update (dt) {},

    onShareBtn: function(){ //分享按钮
        cc.log("点击分享按钮");
        //主动拉起分享接口
        wx.shareAppMessage({
            title: this.shareText,
            imageUrl: cc.url.raw("resources/image/share.png"),
            success(res){
                console.log("转发成功!!!");
            },
            fail(res){
                console.log("转发失败!!!");
            } 
        })
    },
});
